/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * <p>Project: jse2303 - Reg1
 * <p>Powered by webrx On 2023-07-18 09:09:11
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Reg2 {
    public static void main(String[] args) {
        //判断有没有汉字
        String str = """
                my10
                                
                java16  java
                                
                        -9       book
                mysql8
                """;

        //System.out.println(str);

        Pattern p = Pattern.compile("-?\\d+");
        Matcher m = p.matcher(str);
        int sum = 0;
        while (m.find()) {
            int t = Integer.parseInt(m.group());
            System.out.println(t);
            sum += t;
            //System.out.println(m.group());
        }
        System.out.println(sum);
        System.out.println("---------------");
        Pattern p2 = Pattern.compile("[a-zA-Z]+");
        Matcher m2 = p2.matcher(str);
        while (m2.find()) {
            System.out.println(m2.group());
        }


    }
}
